package org.example.mybatis.service;

import org.example.mybatis.domain.User;
import org.example.mybatis.mapper.UserMapper;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {
    private final UserMapper userMapper;

    public UserService(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    //简单的请求转发
    public List<User> getAllUsers() {
        return userMapper.findAll();
    }
}

//2.业务逻辑层：调用数据层（mapper）获取或修改数据